package com.sjsu.CMPE226.normalized.jdbc.data;

import java.util.Collection;

public class Network {
	private int networkId;
	private String networkName;

	private Collection<Station> stations;

	public Network() {

	}

	/**
	 * @return the networkId
	 */
	public int getNetworkId() {
		return networkId;
	}

	/**
	 * @param networkId
	 *            the networkId to set
	 */
	public void setNetworkId(int networkId) {
		this.networkId = networkId;
	}

	/**
	 * @return the networkName
	 */
	public String getNetworkName() {
		return networkName;
	}

	/**
	 * @param networkName
	 *            the networkName to set
	 */
	public void setNetworkName(String networkName) {
		this.networkName = networkName;
	}

	/**
	 * @return the stations
	 */
	public Collection<Station> getStations() {
		return stations;
	}

	/**
	 * @param stations
	 *            the stations to set
	 */
	public void setStations(Collection<Station> stations) {
		this.stations = stations;
	}

	public void removeStation(Station s) {
		if (stations == null)
			return;

		stations.remove(s);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + networkId;
		result = prime * result
				+ ((networkName == null) ? 0 : networkName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Network other = (Network) obj;
		if (networkId != other.networkId)
			return false;
		if (networkName == null) {
			if (other.networkName != null)
				return false;
		} else if (!networkName.equals(other.networkName))
			return false;
		return true;
	}
	

}
